package com.example.gongj;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;

/**
 * 指定编码读取
 */
public class InputStreamReaderDemo {
    public static void main(String[] args) throws Exception {
        InputStreamReader isr = new InputStreamReader(new FileInputStream("IO流\\GBK.txt"),"GBK");

        int len = 0;
        char[] c = new char[1024];
        while ((len = isr.read(c)) != -1){
            System.out.println(new String(c,0,len));
        }
    }
}
